package com.eliza.cmps.activity

import android.os.Bundle
import android.widget.SeekBar
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.eliza.cmps.R
import com.eliza.library.tools.InfoTools


class SeekBarActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_seekbar)
        val sb_custom = findViewById<SeekBar>(R.id.SeekBar_custom);
        val txt_cur = findViewById<TextView>(R.id.SeekBar_txt_cur);
//        SeekBar.OnSeekBarChangeListener l

        findViewById<SeekBar>(R.id.SeekBar_normal).setOnSeekBarChangeListener(object :
            SeekBar.OnSeekBarChangeListener {
            override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
                txt_cur.text = "当前进度值:$progress  / 100 "
            }

            override fun onStartTrackingTouch(p0: SeekBar?) {
                InfoTools.LogTools(this::class.java.name, "触碰SeekBar")
            }

            override fun onStopTrackingTouch(p0: SeekBar?) {
                InfoTools.LogTools(this::class.java.name, "放开SeekBar")

            }
        })
        sb_custom.secondaryProgress = 20;
    }


}

